﻿Imports System.Collections.Generic
Imports System.Data
Imports System.Data.SqlClient


''' <summary>
''' Clase de la capa de acceso a datos DAL que implementa el patrón Table Data Gateway para el manejo de la entidad Politicas_Seguridad
''' </summary>
''' <remarks></remarks>
Public Class TDGPoliticas_Seguridad

    Private Shared m_Instance As TDGPoliticas_Seguridad = Nothing


    Public Function Update(conn As SqlConnection, Pwd_Char_Min As Int16, Pwd_Char_Max As Int16, Pwd_Duracion As Int16) As Int16
        Dim command As New SqlCommand
        Dim iRowsAffected As Int16

        command.Connection = conn
        command.CommandType = CommandType.StoredProcedure

        command.CommandText = "dbo.updPoliticas_Seguridad"
        command.Parameters.AddWithValue("@Pwd_Char_Min", Pwd_Char_Min)
        command.Parameters.AddWithValue("@Pwd_Char_Max", Pwd_Char_Max)
        command.Parameters.AddWithValue("@Pwd_Duracion", Pwd_Duracion)

        iRowsAffected = command.ExecuteNonQuery()

        Return iRowsAffected

    End Function

    Public Function Find(conn As SqlConnection) As SqlDataReader
        Dim command As New SqlCommand
        Dim dr As SqlDataReader

        command.Connection = conn
        command.CommandType = CommandType.StoredProcedure

        command.CommandText = "dbo.getPoliticas_Seguridad"


        dr = command.ExecuteReader()

        Return dr

    End Function

    Public Shared ReadOnly Property Instance()
        Get
            If (m_Instance Is Nothing) Then
                m_Instance = New TDGPoliticas_Seguridad()
            End If

            Return m_Instance
        End Get
    End Property

    Private Sub New()
    End Sub

End Class
